#pragma once


namespace Safe
{
	/// <summary>
	/// Exception class that captures a problem building a certificate chain
	/// from an end cert to a trust root
	/// </summary>
	public ref class ChainBuildException : public System::Exception { 

	public:
		/// <summary>
		/// Creates a new ChainBuildException
		/// </summary>
		ChainBuildException() : Exception(){}

		/// <summary>
		/// Creates a new ChainBuildException with the given message
		/// </summary>
		/// <param name='msg>The Exception message</param>
		ChainBuildException(System::String^ msg) : Exception(msg){}

		/// <summary>
		/// Gets/sets the reason why the chain building operation failed
		/// </summary>
		property System::String^ Detail;
	};

	/// <summary>
	/// Exception class that captures a problem requesting, receiving, or 
	/// parsing an OCSP response
	/// </summary>
	public ref class OcspException : public System::Exception { 
	
	public:
		/// <summary>
		/// Creates a new OcspException
		/// </summary>
		OcspException() : Exception(){}

		/// <summary>
		/// Creates a new OcspException with the given message
		/// </summary>
		/// <param name='msg'>The Exception message</param>
		OcspException(System::String^ msg) : Exception(msg){}
	};

	/// <summary>
	/// Exception class that captures a problem encoding or decoding ASN
	/// structures such as RFC3161 timestamp requests and responses.
	/// </summary>
	public ref class AsnException : public System::Exception { 
	public:
		/// <summary>Creates a new AsnException</summary>
		AsnException() : Exception(){}

		/// <summary>
		/// Creates a new AsnException with the given message
		/// </summary>
		/// <param name='msg'>The exception message</param>
		AsnException(System::String^ msg) : Exception(msg){}

		/// <summary>
		/// Creates a new AsnException with the given error code from errors.h
		/// </summary>
		/// <param name='error'>The exception message</param>
		AsnException(int error) : Exception("Error decoding object") { 
			ErrorCode = error;
		}

		/// <summary>
		/// Gets/sets the error code from errors.h
		/// </summary>
		property int ErrorCode;
	};

	/// <summary>
	/// Exception class that captures a problem requesting, receiving, 
	/// parsing or validating an RFC3161 timestamp.
	/// </summary>
	public ref class TimestampException : public System::Exception { 
	public:
		/// <summary>
		/// Creates a new TimestampException
		/// </summary>
		TimestampException() : Exception(){}

		/// <summary>
		/// Creates a new TimestampException with the given exception message
		/// </summary>
		/// <param name='msg'>The Exception message</param>
		TimestampException(System::String^ msg) : Exception(msg){}
	};

}